﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.Admin.Core.Service.sys.Org/ISysOrgService 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       ISysOrgService
* 创建时间：  2025/6/4 15:58:19
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion
using SSPivot.Admin.Core.Service.sys.Org.Dto;
using SSPivot.AspNetCore.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.Admin.Core.Service.sys.Org
{
    /// <summary>
    /// 部门服务
    /// </summary>
    public interface ISysOrgService : IApplicationService
    {
        #region 服务

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<SysOrgDto> GetAsync(long id);

        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        Task<List<SysOrgListDto>> GetListAsync(string key);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<long> AddAsync(SysOrgDto model);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task UpdateAsync(SysOrgDto input);

        /// <summary>
        /// 彻底删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>    
        Task DeleteAsync(long id);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>    
        Task SoftDeleteAsync(long id);

        #endregion

        #region tree

        /// <summary>
        /// 获得本级和下级Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<List<long>> GetChildrenIdListAsync(long id);
        /// <summary>
        /// 获取上级
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        Task<List<SysOrgDto>> GetSupCategory(long id);

        /// <summary>
        /// 获取上级名称
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        Task<List<string>> GetSupCategoryName(long id);
        /// <summary>
        /// 获取下级部门带层级
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<List<SysOrgDto>> GetSubCategoryTreeAsync(QuerySysOrgRequest model);

        /// <summary>
        /// 获取类别tree
        /// </summary>
        /// <returns></returns>
        Task<List<SysOrgDto>> GetAllDataTreeAsync(QuerySysOrgRequest model);
        /// <summary>
        /// 递归获取所有子级部门及层级
        /// </summary>
        /// <param name="model"></param>
        SysOrgDto RecursionCategory(SysOrgDto model, List<SysOrgDto> allData);
        #endregion
    }
}

